package top.healthylife.gateway.platform.eye.api.api.gongshangxinxi;

import cn.hutool.core.bean.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.core.util.SystemConfigUtils;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.eye.api.config.SystemConfig;
import top.healthylife.gateway.platform.eye.api.util.OutHttpUtil;
import top.healthylife.gateway.platform.eye.dto.gongshangxinxi.EyeReqHiInvestDto.req.EyeReqHiInvestDto;
import top.healthylife.gateway.platform.eye.dto.gongshangxinxi.EyeReqHiInvestDto.res.EyeResHiInvestDto;

/**
* @author: GenUtil
* @date: 2020-12-15 19:07:24
*/
@Slf4j
@Service
@ApiServiceExplain(price = 10,docUrl ="http://open.tianyancha.com/open/876",apiName = "历史对外投资[876]", info = "历史对外投资")
public class EyeHiInvestApi implements ParentFace<EyeReqHiInvestDto, EyeResHiInvestDto> {

    static final String URL = "http://open.api.tianyancha.com/services/open/hi/invest/2.0";

    /**
     * 执行这个服务接口
     * 如果成功，返回成功结果，如果接口错误，直接抛异常即可
     *
     * @param eyeDto 请求参数
     * @return 查询的真实结果，如果是失败，则直接返回异常即可
     */
    @Override
    public EyeResHiInvestDto execute(EyeReqHiInvestDto eyeDto) {
        //可直接通过工具类获取这个对象
        SystemConfig o = (SystemConfig) SystemConfigUtils.get();
        return OutHttpUtil.get(URL, BeanUtil.beanToMap(eyeDto), o, EyeResHiInvestDto.class);
    }
}
